<?php
namespace app\admin\model;
class Goods extends \think\Model{
    // 定义全局的查询范围
    protected function base($query){
        $query->where('is_delete',0);
    }    
    //商品表对商品属性表的一对一关联
    public function goodsAttr(){
        return $this->hasOne('GoodsAttr','goods_id','id');
    }
    //商品表对商品类别表的一对一关联
    public function goodsClassification(){
        return $this->hasOne('GoodsClassification','goods_id','id');
    }
    //商品表对商品图片表的一对多关联
    public function goodsPictures(){
        return $this->hasMany('GoodsPictures','goods_id','id');
    }             
}